Skip to content

Conversation

@SebastianM-C
Copy link
Member

There were some things in the docs that I would not necessarily recommend, like

  • θ... for the parameters of a neural network, which for larger neural networks could explode in compile time
  • setting a large maxiters for the ODE solve is not need here and it could be a hindrance in some cases as the NN parameters that need large maxiters would lead to a wrong model anyway
  • ModelingToolkit.setp_oop, since the function is from SII

I've also added the suggestion on how to access the values of the neural network with oprob_fitted.ps[sym_nn](y, oprob_fitted.ps[θ])[1], which would be even shorter if your oprob_fitted variable name was shorter 😅
This is also what I recommend in the NN block tutorial.

Other than that I cleaned up the tests a bit and consolidated the reported issues under a singe testset.

@TorkelE
Copy link
Member

TorkelE commented Oct 30, 2025

This looks all good to me, small comment on the maxiter. So the intention is actually to dial down the maxiter from the default for this exact reason. I.e. the default is 100000, however, for this ODE, if the maxiter has surpassed 10000 that is already a bad sign, so we might as well interrupt the simulation (and in extension, return Inf loss) here already, and not waste time taking 100 times as many steps.

function loss(ps, (oprob_base, set_ps, sample_t, sample_X, sample_Y))
p = set_ps(oprob_base, ps)
new_oprob = remake(oprob_base; p)
new_osol = solve(new_oprob, Tsit5(); saveat = sample_t, verbose = false, maxiters = 10000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment, but if you prefer not to have too many arguments than all good

@ChrisRackauckas
Copy link
Member

Needs to fix the test deps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants